<?php
/*
 * Created on 05-05-2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 require_once('Codes.php');
 require_once('DS.php');
 
 if(!empty($_POST)){
  	if(!isset($_POST['userId'])){
    	return constant("ARGUMENT_NULL").':userId';
  	}
  $userId = $_POST['userId'];
  
    if(!isset($_POST['rid'])){
    	return constant("ARGUMENT_NULL").':rid';
  	}
  $rid = $_POST['rid'];
  } else{
	return constant("ARGUMENT_NULL").':ALL';
  }

  Open();
	$userId = mysql_real_escape_string($userId);
	$rid = mysql_real_escape_string($rid);
	$r = Run("SELECT MsgXml FROM tbl_requests WHERE R_ID = '$rid'");
	if($r != false){
		if(mysql_numrows($r)>0){
			$xml = mysql_result($r,0,"MsgXml");
			echo constant("MESSAGE").":$xml";
		}else{
			echo constant("NO_MESSAGES");
		}
	} else{
		echo constant("TECH_ERROR").':'.mysql_error();
	}
  Close();
?>
